using Gameplay.PVE.Data;

namespace Gameplay.PVE.Entity
{
    public class NpcUnit: UnitBase
    {
        private RenderComponent renderComponent;
        public override void Initialize(UnitData data)
        {
            base.Initialize(data);
            //AddComponent<BehaviorComponent>();
            //AddComponent<SearchComponent>();
            AddComponent<MoveComponent>();
            renderComponent = AddComponent<RenderComponent>();
            AddComponent<ControlComponent>();
            OnInitialize();
        }
        
        public override void Play(string action,float speed = 1)
        {
            renderComponent?.Play(action);
            renderComponent?.SetAnimSpeed(speed);
        }
        
        public override void BeforeUpdate()
        {
            base.BeforeUpdate();
            renderComponent?.BeforeUpdate();
        }

        public override void LateUpdate()
        {
            base.LateUpdate();
            renderComponent?.LateUpdate();
        }
    }
}